package multithreading.pool;

import java.util.concurrent.Callable;
//实现callable接口
public class Text3 implements Callable<String> {
    //对内部要做的事情封装
  private   int n;
    public Text3(int n) {
        this.n = n;
    }
//重写call方法
    @Override
    public String call() throws Exception {
        int sum=0;
        for (int i = 0; i < n; i++) {

           sum+=i;
        }
        return Thread.currentThread().getName()+ "线程求出1-"+n+"的和 为"+sum;

    }
}
